package com.guoranhao.business.param;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * Description:生态链电商 订单商品参数
 * Copyright (c) Department of Research and Development/Beijing
 * All Rights Reserved.
 * @Version 1.0  2018-06-21 10:28.by 王利涛(wanglt@cloud-young.com) 创建
 */
public class EcOrderCommodityParamter extends EcOrderCommodityCommonParamter implements Serializable {
    private static final long serialVersionUID = 3020362788620208028L;
    /**
     * 商品价格
     */
    private BigDecimal skuPrice;
    /**
     * 优惠券id
     */
    private Long couponId=0L;

    /**
     * 是否活动标识
     */
    private Boolean commodityActivityFlag=false;

    public Integer getOriginalPriceSellFlag() {
        return originalPriceSellFlag;
    }

    public void setOriginalPriceSellFlag(Integer originalPriceSellFlag) {
        this.originalPriceSellFlag = originalPriceSellFlag;
    }

    /**
     * 是否原价购买 1:是 0:否
     */
    private Integer originalPriceSellFlag=0;

    public Integer getAllowOriginalPriceSell() {
        return allowOriginalPriceSell;
    }

    public void setAllowOriginalPriceSell(Integer allowOriginalPriceSell) {
        this.allowOriginalPriceSell = allowOriginalPriceSell;
    }

    private Integer allowOriginalPriceSell;
    /**
     * 活动商品skuId
     */
    private Long activitySkuId;

    public Long getActivitySkuId() {
        return activitySkuId;
    }

    public void setActivitySkuId(Long activitySkuId) {
        this.activitySkuId = activitySkuId;
    }

    public Boolean getCommodityActivityFlag() {
        return commodityActivityFlag;
    }

    public void setCommodityActivityFlag(Boolean commodityActivityFlag) {
        this.commodityActivityFlag = commodityActivityFlag;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public BigDecimal getSkuPrice() {
        return skuPrice;
    }

    public void setSkuPrice(BigDecimal skuPrice) {
        this.skuPrice = skuPrice;
    }

    public Long getCouponId() {
        return couponId;
    }

    public void setCouponId(Long couponId) {
        this.couponId = couponId;
    }

    @Override
    public String toString() {
        return "EcOrderCommodityParameter{" +
                "commoditySkuId=" + this.getCommoditySkuId() +
                ", quantity=" + this.getQuantity() +
                ", commodityId=" + this.getCommodityId() +
                ", commodityActivityId=" + this.getCommodityActivityId() +
                ", skuPrice=" + skuPrice.setScale(2,BigDecimal.ROUND_HALF_UP).toString() +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof EcOrderCommodityParamter)) return false;

        EcOrderCommodityParamter that = (EcOrderCommodityParamter) o;

        if (!this.getCommoditySkuId().equals(that.getCommoditySkuId())) return false;
        if (!this.getQuantity().equals(that.getQuantity())) return false;
        if (!this.getCommodityActivityId().equals(that.getCommodityActivityId())) return false;
        return this.getCommodityId().equals(that.getCommodityId());

    }

    @Override
    public int hashCode() {
        int result = this.getCommoditySkuId().hashCode();
        result = 31 * result + this.getQuantity().hashCode();
        result = 31 * result + this.getCommodityId().hashCode();
        result = 31 * result + this.getCommodityActivityId().hashCode();
        return result;
    }

}
